package com.idbk.chargestation.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.idbk.chargestation.fragment.FragmentBookEnd;
import com.idbk.chargestation.fragment.FragmentBooking;

import java.util.ArrayList;
import java.util.List;

public class BookingTabAdapter extends FragmentPagerAdapter {

	private String[] mTitles;
	private List<Fragment> mFragmentList;

	public BookingTabAdapter(FragmentManager fm,
                             String[] titles) {
		super(fm);
		initFragmentList();
		mTitles = titles;
	}

	private void initFragmentList() {
		mFragmentList = new ArrayList<Fragment>();
		mFragmentList.add(new FragmentBooking());
		mFragmentList.add(new FragmentBookEnd());
	}

	@Override
	public Fragment getItem(int arg0) {
		// TODO Auto-generated method stub
		return mFragmentList.get(arg0);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mFragmentList.size();
	}

	@Override
	public CharSequence getPageTitle(int position) {
		return mTitles[position];
	}

}
